package com.woniuxy.springmvcparam.controller;

import com.woniuxy.springmvcparam.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author linke
 * @version 1.0
 * @className: UserController
 * @description: 用户注册  参数对象转换
 * @date 2021/11/13 20:40
 */
@RequestMapping("/user")
@Controller
public class UserController {


    /**
     * String 可以向 对象进行执行转换
     *
     * @param userBean
     * @return
     */
    @RequestMapping(value = "/register")
    public String register(UserBean userBean) {

        System.out.println(userBean);//UserBean(id=null, userName=333, loginName=123, password=2222, age=22, marray=true, income=2222.0, hobbys=[0])
        //增加时间 自定义转换器
        //UserBean(id=null, userName=22, loginName=213, password=11111, age=22222, marray=true, income=2222.0, hobbys=[1], birthday=Fri Nov 11 00:00:00 CST 2011)
        return "index";
    }
    /**
     * String 可以向 基本数据类型，包装类型，String ,String[] 直接完成转换
     * @param loginName
     * @param userName
     * @param password
     * @param age
     * @param marry
     * @param income
     * @param hobbys
     * @return
     */
    /*    @RequestMapping(value="/register")
        public String register(String loginName, String userName, String password,
                               int age, boolean marry, double income, String[] hobbys) {

            System.out.println(loginName);
            System.out.println(userName);
            System.out.println(password);
            System.out.println(age);
            System.out.println(marry);
            System.out.println(income);
            System.out.println(Arrays.toString(hobbys));


            return "index";
        }*/
}